/*
 * @Author: 李文奇 16061236+li-wenqi2@user.noreply.gitee.com
 * @Date: 2025-10-29 15:08:06
 * @LastEditors: 李文奇 16061236+li-wenqi2@user.noreply.gitee.com
 * @LastEditTime: 2025-10-29 20:10:23
 * @FilePath: \a1028\src\components\DatePopup.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React from 'react'
import { CalendarPicker } from 'antd-mobile'
import dayjs from 'dayjs'
import { citySetDate } from '../reducers/cigySlice'
import { useDispatch } from 'react-redux'
function DatePopup({ visible1, setVisible1 }) {
    const dispatch = useDispatch()
    return (
        <div>
            <CalendarPicker
                visible={visible1}
                min={new Date()}
                max={dayjs().add(7, 'day').valueOf()}
                selectionMode='single'
                // defaultValue={singleDate}
                onClose={() => setVisible1(false)}
                onMaskClick={() => setVisible1(false)}
                onConfirm={(value) => {
                    const nDate = dayjs(value).format('YYYY-MM-DD')
                    dispatch(citySetDate(nDate))
                }}
            />
        </div>
    )
}

export default DatePopup
